/*===侧导航==*/
$(".mui-mbar-gwc").click(function(){
	if($(".mui-mbar").css("right") == "0px")
		$(".mui-mbar").animate({"right":"-264px"});
	else
		$(".mui-mbar").animate({"right":"0px"});
});
 /*在线客服、投诉建议、二维码、返回顶部*/
  $(".mui-mbar-all").hover(function(){
	$(this).find(".mui-mbar-all").css({"background":"#333030"})
	$(this).find(".mui-mbar-last").show().animate({"left":"-75px","opacity":"1"});
 },function(){
	 $(this).find(".mui-mbar-last").stop(true).animate({"left":"-110px","opacity":"0"});
	 $(this).find(".mui-mbar-all").css({"background":"none"})
 });
 
  $(".mui-mbar-weixin").hover(function(){
	  $(this).find(".mui-mbar-weixin").css({"background":"#333030"})
	$(this).find(".mui-weima").show().animate({"left":"-146px","opacity":"1"});
 },function(){
	 $(this).find(".mui-weima").stop(true).animate({"left":"-180px","opacity":"0"});
	  $(this).find(".mui-mbar-weixin").css({"background":"none"})
 });
  
$(function(){ 
	$(document).bind("click",function(e){ 
		var target = $(e.target); 
		if(target.closest(".mui-mbar").length == 0){ 
		$(".mui-mbar").animate({"right":"-264px"});
		} 
	}) 
})

function cart_tr_mouseover(obj){
	$(obj).find(".table-close").show();
}
function cart_tr_mouseout(obj){
	$(obj).find(".table-close").hide();
}

function cart_check_click(obj){
	var checked	=	$(obj).is(':checked');
	if(checked){
		$("input[name='rowid[]']").prop('checked',checked);
	}else{
		$("input[name='rowid[]']").prop('checked',checked);
	}
	one_price_click()
}
function one_price_click(){
	var n	=	$("input[name='rowid[]']:checked").length;
	if( n == 0 )	$("#cart_select_div").css('display','none');
	else{
		var amount	=	0;
		$("input[name='rowid[]']:checked").each(function(){
			var id_arr	=	$(this).attr('id').split('_');
			amount	+=	Number($("#cart_goods_price_"+id_arr[1]).val());
		})
		$("#cart_select_num").html(n);
		$("#cart_select_amount").html(amount.toFixed(2));
		$("#cart_select_div").css('display','block');	
	}
}
function right_huigo_func(url){
	var a	=	$("input[name='rowid[]']").length;
	var n	=	$("input[name='rowid[]']:checked").length;
	if(n == 0){
		alert("请选择商品");
		return false;
	}
	var rowids	=	'';
	var	suffix	=	'';
	$("input[name='rowid[]']:checked").each(function(){rowids+=suffix+$(this).val();suffix=',';})
	var str	=	'';
	if(a != n)	str	+=	'?rowids='+rowids;
	location.href	=	url+str;
}

function right_jingpai_func(url){
	var n	=	$("input[name='rowid[]']:checked").length;
	if(n == 0){
		alert("请选择商品");
		return false;
	}else if(n != 1){
		alert("发布淘二手每次只能选择一个商品");
		return false;
	}
	var id_arr	=	$("input[name='rowid[]']:checked").attr('id').split('_');
	var sn	=	$("input[name='rowid[]']:checked").val();
	var gid	=	$("#cache_gid_"+id_arr[1]).val();
	var	url	=	url.replace(".html","/"+gid+"/"+sn+".html");
	location.href	=	url;
}

function right_jishou_func(url){
	var a	=	$("input[name='rowid[]']").length;
	var n	=	$("input[name='rowid[]']:checked").length;
	if(n == 0){
		alert("请选择商品");
		return false;
	}
	var rowids	=	'';
	var	suffix	=	'';
	$("input[name='rowid[]']:checked").each(function(){rowids+=suffix+$(this).val();suffix=',';})
	var str	=	'';
	if(a != n)	str	+=	'?rowids='+rowids;
	location.href	=	url+str;
}


function remove_cart_extends(url,rowid){
	$.post(url,{'rowid':rowid},function(data){
		var obj	=	eval(data);
		if(obj[0]	==	1){
			var arr	= obj[1];
			//$("#cart_items_"+rowid).hide("slow"); 
			$("#cart_items_"+rowid).remove();
			if(arr['cart_total_items'] == 0){
				$("#cart_total_items").removeClass();	
				$("#cart_total_items").html('');
			}else{
				$("#cart_total_items").html(arr['cart_total_items']);
			}
			one_price_click();
			
		}else if(obj[0]	==	0){
			alert("操作失败");
		}
	});
	
	
}

//回到顶部
function goTop(){
	$('html,body').animate({'scrollTop':0},600); 
}; 